from django.db import models

# Create your models here.


class Admin(models.Model):
    """ 管理员 """
    username = models.CharField(verbose_name="用户名", max_length=32)
    password = models.CharField(verbose_name="密码", max_length=64)


class Department(models.Model):
    """ 部门表 """
    title = models.CharField(verbose_name="标题", max_length=32)


class Bug(models.Model):
    """ 缺陷表 """
    title = models.CharField(verbose_name="标题", max_length=64, blank=False, null=False)
    status = models.CharField(verbose_name="状态", max_length=64, blank=True, null=True)
    priority_choices = (
        (1, "紧急"),
        (2, "高"),
        (3, "中"),
        (4, "低"),
    )
    priority = models.SmallIntegerField(verbose_name="优先级", choices=priority_choices, default=priority_choices[2])
    creator = models.CharField(verbose_name="创建者", max_length=32, blank=True, null=True)
    project = models.CharField(verbose_name="归属项目", max_length=64, blank=True, null=True)


class PrettyNum(models.Model):
    """ 靓号表 """
    mobile = models.CharField(verbose_name="手机号", max_length=11)
    price = models.IntegerField(verbose_name="价格", default=0)

    level_choices = (
        (1, "1级"),
        (2, "2级"),
        (3, "3级"),
        (4, "4级"),
    )
    level = models.SmallIntegerField(verbose_name="级别", choices=level_choices, default=1)

    status_choices = (
        (1, "已占用"),
        (2, "未使用")
    )
    status = models.SmallIntegerField(verbose_name="状态", choices=status_choices, default=2)


class User(models.Model):
    """ 用户 """
    name = models.CharField(verbose_name="姓名", max_length=32)
    username = models.CharField(verbose_name="用户名", max_length=32)
    password = models.CharField(verbose_name="密码", max_length=64)
    phone_number = models.CharField(verbose_name="电话号", max_length=64)
    role_choices = (
        (0, "访客"),
        (1, "前端开发工程师"),
        (2, "后端开发工程师"),
        (3, "软件测试工程师"),
        (4, "产品经理")
    )
    role = models.SmallIntegerField(verbose_name="角色", choices=role_choices)


